//
// Created by mio on 25-5-13.
//

#ifndef VIDEOENCODER_H
#define VIDEOENCODER_H


#include <memory>
#include "AV_Common.h"
#include "VideoConvert.h"

class H264Encoder : public EncodBase
{
public:
    H264Encoder();
    H264Encoder(const H264Encoder&) = delete;
    H264Encoder& operator=(const H264Encoder&) = delete;
    ~H264Encoder();
public:
    bool Open(AVConfig& video_config) override;
    void Close()override;
    AVPacketPtr Encode(const quint8* data,quint32 width,quint32 height,quint32 data_size,quint64 pts = 0);
private:
    qint64  pts_;
    quint32 width_;
    quint32 height_;
    bool force_idr_;
    AVFramePtr  rgba_frame_;
    AVPacketPtr h264_packet_;
    std::unique_ptr<VideoConvert> converter_;
    std::string current_codec_name_; // 新增: 存储当前使用的编码器名称
};




#endif //VIDEOENCODER_H
